import tkinter

def main():
    counter=0
    flag=False
    def intervalCountdown():
        interval=int(entry.get())
        nonlocal flag
        nonlocal counter
        if counter<10 and flag:
            counter+=1
            label.config(text=f'进行中，间隔为：{interval}，已触发：{counter}')
            window.after(interval,intervalCountdown)
        else:
            flag=False
            label.config(text=f'结束，间隔为：{interval}，共触发：{counter}')

    def startInterval():
        nonlocal flag
        flag=True
        intervalCountdown()
    window=tkinter.Tk()
    window.title("鼠标自动左键点击")
    window.geometry('400x200')

    entry=tkinter.Entry()
    entry.pack()

    label=tkinter.Label(window,text='未开始。',fg='green')
    label.pack(expand=True)

    btn=tkinter.Button(window, text="开始", command=startInterval)
    btn.pack(side='left')

    btnQuid=tkinter.Button(window, text="退出", command=window.quit)
    btnQuid.pack(side='right')


    window.mainloop()
if __name__ == '__main__':
    main()